<template>
	<view class="page page-picture clearfix">
		<block v-for="(item, index) in dataList" :key="index">
			<view class="item bg-cover" :style="{backgroundImage: 'url(' + item + ')'}" @click="previewImage(index)"></view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: []
			}
		},
		onLoad (options) {
			// 酒店详情
			this.$Http({
				url: 'hotelInfo',
				data: {
					id: options.hotelId,
					type: 'short',
				},
			}).then(res => {
				res.data.images.forEach(item => {
					this.dataList.push(this.$Config.http_static + item)
				})
			});
		},
		methods: {
			// 图片放大
			previewImage (e) {
				uni.previewImage({
					current: e, // 当前显示图片的http链接
					urls: this.dataList // 需要预览的图片http链接列表
				})
			}
		}
	}
</script>

<style lang="less">
	/* 酒店图片 */
	.page-picture{
		padding-top: 30rpx;
		.item{width: 350rpx;height: 260rpx;float: left;margin-left: calc(50rpx / 3);margin-bottom: 16rpx;}
	}
</style>
